package com.gopay.common.domain.dps;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

import com.gopay.common.cipher.utils.SensitiveInfoUtils;
import com.gopay.common.domain.BaseEntity;

@Entity
@Table(name = "WA_CARD_REPAYMENT")
public class CardRepayment extends BaseEntity {

	private static final long serialVersionUID = -1633458906480141509L;

	private Long cardId;
	private String custId;
	/**
	 * 还款人姓名
	 */
	private String cardName;
	/**
	 * 银行编码
	 */
	private String bankCode;
	/**
	 * 银行卡号
	 */
	private String bankAcctNum;
	/**
	 * 创建时间
	 */
	private Date createTime;
	/**
	 * 还款提醒日
	 */
	private Long repaymenDay;
	/**
	 * 是否开通还款提醒 1 开启 2关闭
	 */
	private Long repayme;
	/**
	 * 更新时间
	 */
	private Date lastupdtime;
	/**
	 * 乐观锁
	 */
	private Long version;
	/**
	 * 卡片类型：1代表信用卡 2代表储蓄卡 3 代表 转账记录
	 */

	private Long bankType;
	/**
	 * 转账收款人cust_id 只用于接受转账记录使用 此时其他字段可能都为空等操作
	 */
	private String transferAtsCustId;
	/**
	 * "删除标识   0 - 未删除   1 - 已删除"
	 */
	private int isdel;

	public CardRepayment(Long cardId, String custId, String cardName, String bankCode, String bankAcctNum,
			Date createTime, Long repaymenDay, Long repayme, Date lastupdtime, Long version, Long bankType,
			String transferAtsCustId, int isdel) {
		super();
		this.cardId = cardId;
		this.custId = custId;
		this.cardName = cardName;
		this.bankCode = bankCode;
		this.bankAcctNum = bankAcctNum;
		this.createTime = createTime;
		this.repaymenDay = repaymenDay;
		this.repayme = repayme;
		this.lastupdtime = lastupdtime;
		this.version = version;
		this.bankType = bankType;
		this.transferAtsCustId = transferAtsCustId;
		this.isdel = isdel;
	}

	public CardRepayment() {
		super();
		// TODO Auto-generated constructor stub
	}

	@Id
	@Column(name = "CARD_ID")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "WA_CARD_REPAYMENT_SEQ")
	@SequenceGenerator(name = "WA_CARD_REPAYMENT_SEQ", allocationSize = 1, initialValue = 1, sequenceName = "WA_CARD_REPAYMENT_SEQ")
	public Long getCardId() {
		return cardId;
	}

	public void setCardId(Long cardId) {
		this.cardId = cardId;
	}

	@Column(name = "IS_DEL")
	public int getIsdel() {
		return isdel;
	}

	public void setIsdel(int isdel) {
		this.isdel = isdel;
	}

	@Column(name = "BANK_TYPE")
	public Long getBankType() {
		return bankType;
	}

	public void setBankType(Long bankType) {
		this.bankType = bankType;
	}

	@Column(name = "TRANSFER_ATS_CUST_ID")
	public String getTransferAtsCustId() {
		return transferAtsCustId;
	}

	public void setTransferAtsCustId(String transferAtsCustId) {
		this.transferAtsCustId = transferAtsCustId;
	}

	@Column(name = "CUST_ID")
	public String getCustId() {
		return custId;
	}

	public void setCustId(String custId) {
		this.custId = custId;
	}

	@Column(name = "CARD_NAME")
	public String getCardName() {
		/**
		 * modify by zyt，2017-2-22 在程序中获取的时候进行解密操作，如果是hibernate自己调用（save等），则返回原值；
		 */
		this.cardName = SensitiveInfoUtils.autoReencrypt(this.cardName);
		return SensitiveInfoUtils.smartDecryptWithCheck(this.cardName);
	}

	public void setCardName(String cardName) {
		/**
		 * modified by zyt，2017-2-22 判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
		 */
		this.cardName = SensitiveInfoUtils.smartEncryptWithCheck(cardName);
	}

	@Column(name = "BANK_CODE")
	public String getBankCode() {
		return bankCode;
	}

	public void setBankCode(String bankCode) {
		this.bankCode = bankCode;
	}

	@Column(name = "BANK_ACCT_NUM")
	public String getBankAcctNum() {
		/**
		 * modify by zyt，2017-2-22 在程序中获取的时候进行解密操作，如果是hibernate自己调用（save等），则返回原值；
		 */
		this.bankAcctNum = SensitiveInfoUtils.autoReencrypt(this.bankAcctNum);
		return SensitiveInfoUtils.smartDecryptWithCheck(this.bankAcctNum);
	}

	public void setBankAcctNum(String bankAcctNum) {
		/**
		 * modified by zyt，2017-2-22 判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
		 */
		this.bankAcctNum = SensitiveInfoUtils.smartEncryptWithCheck(bankAcctNum);
	}

	@Column(name = "CREATE_TIME")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "REPAYMEN_DAY")
	public Long getRepaymenDay() {
		return repaymenDay;
	}

	public void setRepaymenDay(Long repaymenDay) {
		this.repaymenDay = repaymenDay;
	}

	@Column(name = "REPAYME")
	public Long getRepayme() {
		return repayme;
	}

	public void setRepayme(Long repayme) {
		this.repayme = repayme;
	}

	@Column(name = "LAST_UPD_TIME")
	@Temporal(TemporalType.TIMESTAMP)
	public Date getLastupdtime() {
		return lastupdtime;
	}

	public void setLastupdtime(Date lastupdtime) {
		this.lastupdtime = lastupdtime;
	}

	@Version
	@Column(name = "VERSION")
	public Long getVersion() {
		return version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

}
